package testing;

import java.io.BufferedReader;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import java.util.Stack;

import org.junit.Test;

import bot.City;
import bot.Util;

public class RacePercentagesTest {
	private File cities = new File("c:\\Users\\Jamison\\Documents\\PopulationInfo\\NebraskaLinks.txt");
	private File demo = new File("c:\\Users\\Jamison\\Documents\\PopulationInfo\\NebraskaCensus.txt");
	private File area = new File("c:\\Users\\Jamison\\Documents\\PopulationInfo\\NebraskaArea.txt");
	
	@Test
	public void test(){
		List<City> list = new ArrayList<City>();
		try{
			BufferedReader reader = new BufferedReader(new FileReader(cities));
			String line = null;
			while ((line = reader.readLine()) != null){
				list.add(new City(demo, area, Util.parseName(line)));
			}
		} 
		catch (FileNotFoundException e){
			e.printStackTrace();
		}
		catch (IOException e){
			e.printStackTrace();
		}
		
		for (City city: list){
			double white = Double.parseDouble(city.getPercentWhite());
			double black = Double.parseDouble(city.getPercentBlack());
			double asian = Double.parseDouble(city.getPercentAsian());
			double nativeAmerican = Double.parseDouble(city.getPercentNative());
			double pacific = Double.parseDouble(city.getPercentPacific());
			double two = Double.parseDouble(city.getPercentTwoOrMore());
			double other = Double.parseDouble(city.getPercentOther());
			double sum = white + black + asian + nativeAmerican + pacific + two + other;
			if (sum < 99.9 || sum > 100.1){
				System.out.println(city.getName() + " " + sum);
			}
		}
	}
}
